package com.module.my.adapter.holder.vip

import android.graphics.Paint
import android.view.ViewGroup
import com.module.base.base.adapter.BaseViewHolder
import com.module.base.utils.StringUtils
import com.module.my.R
import com.module.my.bean.VipConfigBean
import com.module.my.databinding.MyItemVipPriceBinding

class VipPriceHolder(parent: ViewGroup) :
    BaseViewHolder<VipConfigBean, MyItemVipPriceBinding>(parent) {

    override fun initView() {
        super.initView()
        mDatabind.tvPrice.paint.flags = Paint.STRIKE_THRU_TEXT_FLAG

    }

    override fun convert(bean: VipConfigBean, position: Int) {
        mDatabind.tvTitle.text = bean.title
        mDatabind.tvTitle2.text = bean.subtitle
        mDatabind.tvPrice.text = String.format("原价%s元", StringUtils.formatPrice(bean.price))
        mDatabind.tvVipPrice.text = String.format("¥%s", StringUtils.formatPrice(bean.vipPrice))
        select()
    }

    fun select() {
        mDatabind.ivSelect.setImageResource(if (data.isSelect) R.drawable.app_ic_checkbox_select else R.drawable.app_ic_checkbox)
    }
}